package commands;

import main.InputHandler;
import util.*;

/*
 * Command used to retrieve a command from DefineCommand's memory
 */
public class GetCommand extends Command{
	public static String name = "get";
	public static String help = "Name: get \n>get {str} \n>get (var name) \n>Command to get variable stored with define.";
	
	public static boolean test(InputHandler handler, StringList words){
		if(StringChecker.testWord(words, 0, "get")){
			if(DefineCommand.containsKey(words.get(1)) && words.get(1) != "null"){
				handler.terminal.write(DefineCommand.get(words.get(1)).toString());
			}else{
				handler.terminal.write("Couldn't access variable");
			}
			return true;
		}
		return false;
	}
}
